package com.you.atlas.web.place.module.screen;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.citrus.turbine.Context;
import com.alibaba.citrus.turbine.dataresolver.Param;
import com.you.atlas.biz.place.service.PlaceQueryService;
import com.you.atlas.biz.place.service.SmallNoteQueryService;
import com.you.common.ibatis.data.DataList;
import com.you.place.dal.dao.dataobject.PlaceDO;

public class SmallNoteList {

    @Autowired
    private SmallNoteQueryService smallNoteQueryService;

    @Autowired
    private PlaceQueryService     placeQueryService;

    public void execute(@Param(name = "id") Long placeId, @Param(name = "orderType") String orderType,
                        @Param(name = "pageNo") int pageNo, Context context) {
        DataList dataList = null;
        PlaceDO placeDO = placeQueryService.find(placeId);
        if ("byTime".equals(orderType)) {
            dataList = smallNoteQueryService.queryByTime(placeId, pageNo, 15);
        } else {
            dataList = smallNoteQueryService.queryByUseFul(placeId, pageNo, 15);
        }
        context.put("smallNoteList", dataList);
        context.put("placeDO", placeDO);
    }
}
